Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/distance

Package Overview
Dependencies
Maintainers
6
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/distance

turf distance module

  • 6.5.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
6
Created

What is @turf/distance?

@turf/distance is a module of the Turf.js library, which provides geospatial analysis tools. This specific module calculates the distance between two geographical points using various measurement units such as miles, kilometers, and degrees.

What are @turf/distance's main functionalities?

Calculate Distance in Kilometers

This feature calculates the distance between two geographical points in kilometers. The 'from' and 'to' variables represent the coordinates of the two points.

const turf = require('@turf/distance');
const from = [0, 0];
const to = [1, 1];
const options = { units: 'kilometers' };
const distance = turf(from, to, options);
console.log(distance);

Calculate Distance in Miles

This feature calculates the distance between two geographical points in miles. The 'from' and 'to' variables represent the coordinates of the two points.

const turf = require('@turf/distance');
const from = [0, 0];
const to = [1, 1];
const options = { units: 'miles' };
const distance = turf(from, to, options);
console.log(distance);

Calculate Distance in Degrees

This feature calculates the distance between two geographical points in degrees. The 'from' and 'to' variables represent the coordinates of the two points.

const turf = require('@turf/distance');
const from = [0, 0];
const to = [1, 1];
const options = { units: 'degrees' };
const distance = turf(from, to, options);
console.log(distance);

Other packages similar to @turf/distance

Keywords

FAQs

Package last updated on 10 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc